<#include "common.ftl">
package ${_cpck};

import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import ${_cfullname};
import com.cds.framework.test.CdsBaseTestCase;

public class ${_cname}DaoTest extends CdsBaseTestCase {
	
	@Autowired
    private ${_daoname} ${_daouname};
			
	@Test
	public void testInsert${_cname}() {
		uInsert${_cname}();
	}
	@Test
	public void testDelete${_cname}ById() {
		uDelete${_cname}ById();
	}
	@Test
	public void testUpdate${_cname}() {
		uUpdate${_cname}();
	}
	@Test
	public void testGet${_cname}() {
		uGet${_cname}();
	}
	
	public ${_cname} uInsert${_cname}() {
		${_cname} ${_clname} = new ${_cname}();
		${_clname}.set${obj.primaryKey?cap_first}("1");
		${_clname}Dao.insert${_cname}(${_clname});
		return uGet${_cname}();
	}
	public void uDelete${_cname}ById() {
		uInsert${_cname}();
		${_cname} ${_clname} = uGet${_cname}();
		${_clname}Dao.delete${_cname}ById(${_clname}.get${obj.primaryKey?cap_first}());
	}
	public void uUpdate${_cname}() {
		uInsert${_cname}();
		${_cname} ${_clname} = uGet${_cname}();
        ${_clname}Dao.update${_cname}(${_clname});
	}
	public ${_cname} uGet${_cname}() {
		String id = "1";
		${_cname} ${_clname} = ${_clname}Dao.get${_cname}(id);
		Assert.assertNotNull(${_clname});
        return ${_clname};
	}
}